import ibm.cognos.imt.CogReport
import ibm.cognos.imt.DataItem

class MyReport extends CogReport {

    def revenueFact = dataItem("[Sales (query)].[Sales].[Revenue]") {
        dataUsage = 'fact'
        dataType = DataItem.DECIMAL
        aggregate = "average"
    }
//    def year = dataItem("[Sales (query)].[Time].[Year]").dataType(DataItem.INTEGER)
//    def country = dataItem("[Sales (query)].[Branch].[Country]").dataType(DataItem.STRING)
//    def pie = pieChart(revenue as Measure, country as Slices)
//    def bar = combinationChart(revenue as Measure, year as Categories, country as Slices)
////            .filter("[Country] includes ('China','Japan','Brasil','Sweden')")
//    def leftList = list(revenueFact, year, country )
    def year = dataItem("[Sales (query)].[Time].[Year]")
    def list1 = list([revenueFact, year])
    def desc() {
        list1
    }
}


println(new MyReport()
        .modelPath("/content/folder[@name='Samples']/folder[@name='Models']/package[@name='GO Sales (query)']/model[@name='model']")
//        .modelPath(BiServerConfig.getModelPath())
        .getSpec())
